<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        a{
         
            text-decoration: none;
            color: black;
        }
        .active{
            color: green;
            border-top: 2px green solid;
        }
    </style>
</head>
<body>
    <div class="box">
        <a href="#/video" >视频</a>
        <a href="#/live">直播</a>
    </div>
    <div class="content">
        
       
    </div>
</body>
</html>
<script>
   window.onhashchange = function(){
            console.log( location.hash );
            switch( location.hash ){
                case '#/video': video_page(); break;
                case '#/live': live_page(); break;
              
            }
        }
        function video_page(){
           let  str=`
            <ul>
            <li>赵本山徒弟的片酬，小沈阳片酬一年</li>
            <li>赵本山徒弟的片酬，小沈阳片酬一年</li>
            <li>赵本山徒弟的片酬，小沈阳片酬一年</li>
            <li>赵本山徒弟的片酬，小沈阳片酬一年</li>
            <li>赵本山徒弟的片酬，小沈阳片酬一年</li>
            <li>赵本山徒弟的片酬，小沈阳片酬一年</li>
        </ul>
            `
            
            document.querySelector('.content').innerHTML = str;
        }
        function live_page(){
            let str=`
            <ul>
            <li>直播|双十一全球快递"云监工"</li>
            <li>直播|双十一全球快递"云监工"</li>
            <li>直播|双十一全球快递"云监工"</li>
            <li>直播|双十一全球快递"云监工"</li>
            <li>直播|双十一全球快递"云监工"</li>
            <li>直播|双十一全球快递"云监工"</li>
        </ul>
            `
            document.querySelector('.content').innerHTML = str;
        }
        var btns =document.querySelectorAll('a')
        for (let i = 0; i < btns.length; i++) {
        btns[i].onclick = function () {
            for (var j = 0; j < btns.length; j++) {
                btns[j].classList.remove('active')
             
            }
            btns[i].classList.add('active')
          
        }
    }
</script>